/* Component info --------------------------------------------------------------
 * Author   : PURESUN
 * Version  : V1.0.0
 * Notes    : syscfg header file
 * Update   : 2024-04-13
 -----------------------------------------------------------------------------*/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __SYSCFG_H__
#define __SYSCFG_H__

/* Includes ------------------------------------------------------------------*/
#include "pub_types.h"

/* Exported macro ------------------------------------------------------------*/
#define SYS_CFG_FILE_PATH "syscfg.cfg"

/* Exported typedef ----------------------------------------------------------*/
typedef enum
{
    CFG_ERR_OK = 0,
    CFG_ERR_OPEN_FILE,
    CFG_ERR_READ_FILE,
    CFG_ERR_WRITE_FILE,
    CFG_ERR_CLOSE_FILE,
    CFG_ERR_FILE_NOT_EXIST,
    CFG_ERR_PARSE_FILE,
    CFG_ERR_READ_KEY_FAIL
} cfg_err_t;

typedef enum
{
    WORK_MODE_AUTO = 0x00,
    WORK_MODE_MANUAL = 0x01,
    WORK_MODE_DEBUG = 0x02,
    WORK_MODE_SETTING = 0x03,
} work_mode_t;

typedef struct
{
    struct
    {
        work_mode_t work_mode;
    } user;
    struct
    {
        bool wifi_sta;
    } system;
} syscfg_t;

/* Exported variables --------------------------------------------------------*/

/* Exported function prototypes ----------------------------------------------*/
work_mode_t syscfg_get_work_mode(void);
void syscfg_set_work_mode(work_mode_t mode);
void save_syscfg(syscfg_t *syscfg);

#endif /* __SYSCFG_H__ */
